Many electronic apparatus make use of embedded memory devices. Often, the embedded memory devices includes non-volatile memory such as flash memory. An electronic apparatus that includes an embedded memory system, or is connected to a memory system, is often referred to as a host.
When writing data to a conventional flash memory system, a host typically writes data to, and reads data from, addresses within a logical address space of the memory system. The memory system then maps data between the logical address space and the physical blocks of the memory. The host keeps track of the logical addresses of its data files within the logical address space and the memory system may operate without knowledge of this mapping.
A drawback of memory systems that operate in a logical address space is fragmentation. Data written by a host file system may often be fragmented in logical address space because updates to files require the new portions of the files to be rewritten to new logical addresses. Also, as logical memory locations are freed up and added back to the pool of available memory, some free portions may be too small to store files for the host.
When a memory device is sufficiently fragmented, performance may be degraded due to a shortage of large continuous chunks of free space in the memory to write new data. In order to improve performance, the host may need to perform defragmentation in which the host attempts to move data between logical address such that valid data resides in consecutive logical addresses, thereby freeing up large chunks of the memory system.
One scheme for performing defragmentation of a memory system is for the host to read back the data into its own internal RAM and then re-write the data into continuous logical addresses of the memory system. However, this is a slow process that also causes wear on the memory system and uses too much power.